package com.example.demo.controller;

import com.example.demo.mapepr.second.UserMapper;
import com.example.demo.pojo.second.User;
import com.example.demo.service.UserService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;


    @RequestMapping(value = "/findById/{id}",method = RequestMethod.GET)
    public User findById(@PathVariable("id") Integer id){
       return userService.findById(id);
    }

    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public User updateUser(@RequestBody User user){
        return userService.updateUser(user);
    }
}
